﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using WX.WMS.DataModel;
using WX.WMS.Common;
using WX.WMS.BLL;

public partial class StockTake_VerifyInput : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnVerify_Click(object sender, EventArgs e)
    {
        if (ValidateData())
        {
            string result = this.PacketQty.Value.Trim() + ";" + this.PacketQty2.Value.Trim() + ";"
                            + this.NetWeight.Value.Trim() + ";" + this.GrossWeight.Value.Trim();

            Jscript.CloseWindowReturnValues(result);
            return;
        }

    }

    protected bool ValidateData()
    {
        if (GrossWeight.Value.Trim() != string.Empty)
        {
            double pq;
            if (!double.TryParse(GrossWeight.Value.Trim(), out pq))
            {
                ShowMessage("毛重必须为数值类型");
                return false;
            }
        }
        else
        {
            ShowMessage("毛重不能为空");
            return false;
        }
        if (NetWeight.Value.Trim() != string.Empty)
        {
            double pq;
            if (!double.TryParse(NetWeight.Value.Trim(), out pq))
            {
                ShowMessage("净重必须为数值类型");
                return false;
            }
        }
        else
        {
            ShowMessage("净重不能为空");
            return false;
        }

        if (PacketQty.Value.Trim() != string.Empty)
        {
            double pq;
            if (!double.TryParse(PacketQty.Value.Trim(), out pq))
            {
                ShowMessage("大件数必须为数值类型");
                return false;
            }
        }
        else
        {
            ShowMessage("大件数不能为空");
            return false;
        }
        if (PacketQty2.Value.Trim() != string.Empty)
        {
            double pq;
            if (!double.TryParse(PacketQty2.Value.Trim(), out pq))
            {
                ShowMessage("小件数必须为数值类型");
                return false;
            }
        }
        else
        {
            ShowMessage("小件数不能为空");
            return false;
        }

        return true;
    }

    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Jscript.CloseWindow();
        return;
    }
}
